Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ytdl-core

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ytdl-core

Youtube video downloader in pure javascript.

  • 3.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53K
decreased by-58.51%
Maintainers
1
Weekly downloads
 
Created

What is ytdl-core?

The ytdl-core npm package is a YouTube video downloader that allows you to download videos from YouTube and extract information about them. It is commonly used for creating custom video downloaders, streamers, and other applications that require access to YouTube content.

What are ytdl-core's main functionalities?

Download a YouTube Video

This feature allows you to download a YouTube video by providing its URL. The video is saved to a file on your local system.

const ytdl = require('ytdl-core');
const fs = require('fs');

const videoUrl = 'https://www.youtube.com/watch?v=VIDEO_ID';
const output = 'video.mp4';

ytdl(videoUrl)
  .pipe(fs.createWriteStream(output))
  .on('finish', () => {
    console.log('Download completed!');
  });

Get Video Information

This feature allows you to retrieve detailed information about a YouTube video, such as its title, author, and view count.

const ytdl = require('ytdl-core');

const videoUrl = 'https://www.youtube.com/watch?v=VIDEO_ID';

ytdl.getInfo(videoUrl).then(info => {
  console.log('Title:', info.videoDetails.title);
  console.log('Author:', info.videoDetails.author.name);
  console.log('Views:', info.videoDetails.viewCount);
}).catch(err => {
  console.error('Error fetching video info:', err);
});

Download Audio Only

This feature allows you to download only the audio stream of a YouTube video, which is useful for creating audio files from video content.

const ytdl = require('ytdl-core');
const fs = require('fs');

const videoUrl = 'https://www.youtube.com/watch?v=VIDEO_ID';
const output = 'audio.mp3';

ytdl(videoUrl, { filter: 'audioonly' })
  .pipe(fs.createWriteStream(output))
  .on('finish', () => {
    console.log('Audio download completed!');
  });

Other packages similar to ytdl-core

Keywords

FAQs

Package last updated on 22 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc